<template>
    <el-row class="m-adManage">
        <el-tabs v-model="adtiveTab">
            <el-tab-pane label="启动页" name="startPage">
                <div class="tabContent">
                    <el-row class="layout-2">
                        <el-col></el-col>
                        <el-col :span="9" class="right" :offset="15">
                            <span class="time">最后发布时间：2017-05-22  12:00:00</span>
                            <el-button type="primary" @click="search">发布</el-button>
                        </el-col>
                    </el-row>
                    <el-row class="layout-3">
                        <el-table
                                class="table"
                                :data="startPageData.list"
                                highlight-current-row
                                border
                                style="width: 100%"
                        >
                            <el-table-column
                                    show-overflow-tooltip="true"
                                    type="index"
                                    label="id"
                                    fixed
                                    width="50">
                            </el-table-column>
                            <el-table-column
                                    show-overflow-tooltip="true"
                                    prop="device"
                                    label="应用于"
                                    width="200">
                            </el-table-column>
                            <el-table-column
                                    show-overflow-tooltip="true"
                                    prop="position"
                                    label="位置"
                                    width="200">
                            </el-table-column>
                            <el-table-column
                                    show-overflow-tooltip="true"
                                    label="图片"
                                    width="200">
                                <template scope="scope">
                                    <img
                                            :src="scope.row.imageSrc"
                                            v-show="scope.row.imageSrc"
                                            class="minImg"
                                            @click="showImage(scope.$index, scope.row)"
                                    >
                                </template>
                            </el-table-column>
                            <el-table-column
                                    show-overflow-tooltip="true"
                                    label="操作"
                                    class-name="operated"
                                    min-width="200">
                                <template scope="scope">
                                    <el-button
                                            v-show="scope.row.operated == 1"
                                            size="small"
                                            @click="handleEdit('startPage',1,scope.$index, scope.row)">编辑
                                    </el-button>
                                </template>
                            </el-table-column>
                            <el-table-column
                                    show-overflow-tooltip="true"
                                    prop="updateTime"
                                    label="更新时间"
                                    min-width="200">
                            </el-table-column>
                            <el-table-column
                                    show-overflow-tooltip="true"
                                    prop="updatePerson"
                                    label="更新人"
                                    width="100">
                            </el-table-column>
                        </el-table>
                    </el-row>
                </div>
            </el-tab-pane>
            <el-tab-pane label="全屏广告" name="fullAd">
                <div class="tabContent">
                    <el-row class="layout-1">
                        <el-form :model="fullAdData.searchFrom.data" :inline="true">
                            <el-form-item>
                                <el-select clearable v-model="fullAdData.searchFrom.data.device" placeholder="应用于">
                                    <el-option label="Android" value="Android"></el-option>
                                    <el-option label="iOS" value="iOS"></el-option>
                                </el-select>
                            </el-form-item>
                            <el-form-item>
                                <el-select clearable v-model="fullAdData.searchFrom.data.expiryDate" placeholder="有效期">
                                    <el-option label="有效" value="1"></el-option>
                                    <el-option label="未生效" value="2"></el-option>
                                    <el-option label="已过期" value="0"></el-option>
                                </el-select>
                            </el-form-item>
                            <el-form-item>
                                <el-select clearable v-model="fullAdData.searchFrom.data.state" placeholder="状态">
                                    <el-option label="启用" value="启用"></el-option>
                                    <el-option label="禁用" value="禁用"></el-option>
                                </el-select>
                            </el-form-item>
                            <el-form-item>
                                <el-input v-model.trim="fullAdData.searchFrom.data.keyWords"
                                          placeholder="请输入名称查询"></el-input>
                            </el-form-item>
                            <el-button type="primary" icon="search" @click="searchTableData('fullAd')">查找</el-button>
                        </el-form>
                        <el-row>
                            <el-button @click="search">主包</el-button>
                            <el-button @click="search">渠道1</el-button>
                            <el-button @click="search">渠道3</el-button>
                            <el-button @click="search">渠道6</el-button>
                        </el-row>
                    </el-row>
                    <el-row class="layout-2">
                        <el-col :span="15">
                            <el-button icon="plus" @click="addItem('fullAd')">新增</el-button>
                            <el-button icon="check" @click="activeItem('fullAd')">启用</el-button>
                            <el-button icon="warning" @click="disableItem('fullAd')">禁用</el-button>
                            <el-button icon="close" @click="deleteItem('fullAd')">删除</el-button>
                        </el-col>
                        <el-col :span="9" class="right">
                            <span class="time">最后发布时间：2017-05-22  12:00:00</span>
                            <el-button type="primary" @click="search">发布</el-button>
                        </el-col>
                    </el-row>
                    <el-row class="layout-3">
                        <el-table
                                class="table"
                                :data="fullAdData.list"
                                ref="fullAdTable"
                                highlight-current-row
                                @selection-change="fullAdHandleSelectionChange"
                                @sort-change="sortData"
                                border
                                style="width: 100%"
                        >
                            <el-table-column
                                    type="selection"
                                    fixed
                                    width="55">
                            </el-table-column>
                            <el-table-column
                                    show-overflow-tooltip="true"
                                    type="index"
                                    label="ID"
                                    width="80">
                            </el-table-column>
                            <el-table-column
                                    show-overflow-tooltip="true"
                                    prop="title"
                                    label="名称"
                                    width="180">
                            </el-table-column>
                            <el-table-column
                                    show-overflow-tooltip="true"
                                    prop="device"
                                    label="应用于"
                                    width="100">
                            </el-table-column>
                            <el-table-column
                                    show-overflow-tooltip="true"
                                    prop="position"
                                    label="位置"
                                    width="100">
                            </el-table-column>
                            <el-table-column
                                    label="图片"
                                    width="150">
                                <template scope="scope">
                                    <img
                                            :src="scope.row.imageSrc"
                                            v-show="scope.row.imageSrc"
                                            class="minImg"
                                            @click="showImage(scope.$index, scope.row)"
                                    >
                                </template>
                            </el-table-column>
                            <el-table-column
                                    show-overflow-tooltip="true"
                                    label="渠道"
                                    width="80">
                                <template scope="scope">
                                    <i class="el-icon-document"></i>
                                </template>
                            </el-table-column>
                            <el-table-column
                                    show-overflow-tooltip="true"
                                    prop="expiryDate"
                                    label="有效期"
                                    width="300">
                            </el-table-column>
                            <el-table-column
                                    show-overflow-tooltip="true"
                                    label="状态"
                                    width="80">
                                <template scope="scope">
                                    <i class="el-icon-check stateA" v-show="scope.row.state==1"></i>
                                    <i class="el-icon-warning stateB" v-show="scope.row.state==0"></i>
                                </template>
                            </el-table-column>
                            <el-table-column
                                    show-overflow-tooltip="true"
                                    prop="operated"
                                    label="操作"
                                    width="240">
                                <template scope="scope">
                                    <el-button
                                            size="small"
                                            @click="handleEdit('fullAd',1,scope.$index, scope.row)">编辑
                                    </el-button>
                                    <el-button
                                            size="small"
                                            @click="disableItem('fullAd',scope.row)">禁用
                                    </el-button>
                                    <el-button
                                            size="small"
                                            @click="deleteItem('fullAd',scope.row)">删除
                                    </el-button>
                                </template>
                            </el-table-column>
                            <el-table-column
                                    show-overflow-tooltip="true"
                                    prop="updateTime"
                                    label="更新时间"
                                    width="160">
                            </el-table-column>
                            <el-table-column
                                    show-overflow-tooltip="true"
                                    prop="updatePerson"
                                    label="更新人"
                                    min-width="100">
                            </el-table-column>
                        </el-table>
                    </el-row>
                    <el-row class="layout-4">
                        <el-pagination
                                class="pagination"
                                @size-change="handleSizeChange"
                                :current-page="currentPage4"
                                :page-sizes="[20, 40, 100, 200]"
                                :page-size="20"
                                layout="total, sizes, prev, pager, next, jumper"
                                :total="1000">
                        </el-pagination>
                    </el-row>
                </div>
            </el-tab-pane>
            <el-tab-pane label="广告位" name="adsense">
                <div class="tabContent">
                    <el-row class="layout-1">
                        <el-form :model="adsenseData.searchFrom.data" :inline="true">
                            <el-form-item>
                                <el-select clearable v-model="adsenseData.searchFrom.data.device" placeholder="应用于">
                                    <el-option label="Android" value="Android"></el-option>
                                    <el-option label="iOS" value="iOS"></el-option>
                                </el-select>
                            </el-form-item>
                            <el-form-item>
                                <el-select clearable v-model="adsenseData.searchFrom.data.applyUser" placeholder="适用账户">
                                    <el-option label="真实" value="1"></el-option>
                                    <el-option label="模拟" value="2"></el-option>
                                    <el-option label="游客" value="3"></el-option>
                                </el-select>
                            </el-form-item>
                            <el-form-item>
                                <el-select clearable v-model="adsenseData.searchFrom.data.position" placeholder="位置">
                                    <el-option label="首页弹窗广告" value="0"></el-option>
                                    <el-option label="首页头部轮播广告" value="1"></el-option>
                                    <el-option label="首页中间广告" value="2"></el-option>
                                </el-select>
                            </el-form-item>
                            <el-form-item>
                                <el-select clearable v-model="adsenseData.searchFrom.data.expiryDate" placeholder="有效期">
                                    <el-option label="有效" value="1"></el-option>
                                    <el-option label="未生效" value="2"></el-option>
                                    <el-option label="已过期" value="0"></el-option>
                                </el-select>
                            </el-form-item>
                            <el-form-item>
                                <el-select clearable v-model="adsenseData.searchFrom.data.state" placeholder="状态">
                                    <el-option label="启用" value="启用"></el-option>
                                    <el-option label="禁用" value="禁用"></el-option>
                                </el-select>
                            </el-form-item>
                            <el-form-item>
                                <el-input v-model.trim="adsenseData.searchFrom.data.keyWords"
                                          placeholder="请输入名称查询"></el-input>
                            </el-form-item>
                            <el-button type="primary" icon="search" @click="searchTableData('adsense')">查找</el-button>
                        </el-form>
                        <el-row>
                            <el-button @click="search">主包</el-button>
                            <el-button @click="search">渠道1</el-button>
                            <el-button @click="search">渠道3</el-button>
                            <el-button @click="search">渠道6</el-button>
                        </el-row>
                    </el-row>
                    <el-row class="layout-2">
                        <el-col :span="15">
                            <el-button icon="plus" @click="addItem('adsense')">新增</el-button>
                            <el-button icon="check" @click="activeItem('adsense')">启用</el-button>
                            <el-button icon="warning" @click="disableItem('adsense')">禁用</el-button>
                            <el-button icon="close" @click="deleteItem('adsense')">删除</el-button>
                        </el-col>
                        <el-col :span="9" class="right">
                            <span class="time">最后发布时间：2017-05-22  12:00:00</span>
                            <el-button type="primary" @click="search">发布</el-button>
                        </el-col>
                    </el-row>
                    <el-row class="layout-3">
                        <el-table
                                class="table"
                                :data="adsenseData.list"
                                ref="adsenseTable"
                                @selection-change="adsenseHandleSelectionChange"
                                border
                                style="width: 100%"
                        >
                            <el-table-column
                                    type="selection"
                                    fixed
                                    width="55">
                            </el-table-column>
                            <el-table-column
                                    show-overflow-tooltip="true"
                                    type="index"
                                    label="ID"
                                    fixed
                                    width="80">
                            </el-table-column>
                            <el-table-column
                                    show-overflow-tooltip="true"
                                    prop="title"
                                    label="名称"
                                    width="180">
                            </el-table-column>
                            <el-table-column
                                    show-overflow-tooltip="true"
                                    prop="device"
                                    label="应用于"
                                    width="100">
                            </el-table-column>
                            <el-table-column
                                    show-overflow-tooltip="true"
                                    prop="position"
                                    label="位置"
                                    width="100">
                            </el-table-column>
                            <el-table-column
                                    show-overflow-tooltip="true"
                                    prop="applyUser"
                                    label="适用账户"
                                    width="100">
                            </el-table-column>
                            <el-table-column
                                    label="图片"
                                    width="150">
                                <template scope="scope">
                                    <img
                                            :src="scope.row.imageSrc"
                                            v-show="scope.row.imageSrc"
                                            class="minImg"
                                            @click="showImage(scope.$index, scope.row)"
                                    >
                                </template>
                            </el-table-column>
                            <el-table-column
                                    show-overflow-tooltip="true"
                                    label="渠道"
                                    width="80">
                                <template scope="scope">
                                    <i class="el-icon-document"></i>
                                </template>
                            </el-table-column>
                            <el-table-column
                                    show-overflow-tooltip="true"
                                    prop="expiryDate"
                                    label="有效期"
                                    width="300">
                            </el-table-column>
                            <el-table-column
                                    show-overflow-tooltip="true"
                                    label="状态"
                                    width="80">
                                <template scope="scope">
                                    <i class="el-icon-check stateA" v-show="scope.row.state==1"></i>
                                    <i class="el-icon-warning stateB" v-show="scope.row.state==0"></i>
                                </template>
                            </el-table-column>
                            <el-table-column
                                    show-overflow-tooltip="true"
                                    prop="operated"
                                    label="操作"
                                    width="240">
                                <template scope="scope">
                                    <el-button
                                            size="small"
                                            @click="handleEdit('adsense',1,scope.$index, scope.row)">编辑
                                    </el-button>
                                    <el-button
                                            size="small"
                                            @click="disableItem('adsense',scope.row)">禁用
                                    </el-button>
                                    <el-button
                                            size="small"
                                            @click="deleteItem('adsense',scope.row)">删除
                                    </el-button>
                                </template>
                            </el-table-column>
                            <el-table-column
                                    show-overflow-tooltip="true"
                                    prop="updateTime"
                                    label="更新时间"
                                    width="160">
                            </el-table-column>
                            <el-table-column
                                    show-overflow-tooltip="true"
                                    prop="updatePerson"
                                    label="更新人"
                                    min-width="100">
                            </el-table-column>
                        </el-table>
                    </el-row>
                    <el-row class="layout-4">
                        <el-pagination
                                class="pagination"
                                @size-change="handleSizeChange"
                                :current-page="currentPage4"
                                :page-sizes="[20, 40, 100, 200]"
                                :page-size="20"
                                layout="total, sizes, prev, pager, next, jumper"
                                :total="1000">
                        </el-pagination>
                    </el-row>
                </div>
            </el-tab-pane>
        </el-tabs>
        <!--弹窗-->
        <el-dialog :title="dialogData.title" :visible.sync="dialogData.isShow" class="m-adManageDialog" size="small">
            <el-form ref="periodForm" :model="dialogData.data" v-loading=dialogData.loading>
                <el-row class="row" v-if="dialogData.type != 'startPage'">
                    <el-col :span="4" class="label">名称<span class="isMust">*</span></el-col>
                    <el-col :span="10">
                        <el-form-item>
                            <el-input v-model="dialogData.data.title"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="2"></el-col>
                    <el-col :span="6" :offset="1">
                        <el-form-item class="iseffective">
                            <el-switch v-model="dialogData.data.state"></el-switch>
                        </el-form-item>
                        <div class="flag">{{dialogData.data.state ? '开启' : '关闭'}}</div>
                    </el-col>
                </el-row>
                <el-row class="row">
                    <el-col :span="4" class="label">应用于<span class="isMust">*</span></el-col>
                    <el-col :span="10">
                        <el-form-item>
                            <el-radio-group v-model="dialogData.data.device">
                                <el-radio :label=0>Android</el-radio>
                                <el-radio :label=1>iOS</el-radio>
                            </el-radio-group>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row class="row" v-if="dialogData.type == 'adsense'">
                    <el-col :span="4" class="label">适用账户<span class="isMust">*</span></el-col>
                    <el-col :span="10">
                        <el-form-item>
                            <el-checkbox-group v-model="dialogData.data.userType">
                                <el-checkbox :label=0>真实账户</el-checkbox>
                                <el-checkbox :label=1>模拟账户</el-checkbox>
                                <el-checkbox :label=2>游客</el-checkbox>
                            </el-checkbox-group>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row class="row" v-if="dialogData.type != 'adsense'">
                    <el-col :span="4" class="label">位置<span class="isMust">*</span></el-col>
                    <el-col :span="10">
                        <el-row>
                            <el-col :span="24">
                                <el-form-item>
                                    <el-radio-group v-model="dialogData.data.position">
                                        <el-radio>{{dialogData.type == 'startPage' ? '启动页' : '广告位'}}</el-radio>
                                    </el-radio-group>
                                </el-form-item>
                            </el-col>
                            <el-col :span="24" class="tipmsg">{{dialogData.data.imageMsg}}</el-col>
                        </el-row>
                    </el-col>
                </el-row>
                <el-row class="row" v-else>
                    <el-col :span="4" class="label">位置<span class="isMust">*</span></el-col>
                    <el-col :span="10">
                        <el-row>
                            <el-col :span="24">
                                <el-form-item>
                                    <el-select v-model="dialogData.data.position3" class="select">
                                        <el-option value=0>首页弹窗广告</el-option>
                                        <el-option value=1>首页头部广告</el-option>
                                        <el-option value=2>首页中间广告</el-option>
                                    </el-select>
                                </el-form-item>
                            </el-col>
                            <el-col :span="24" class="tipmsg">{{dialogData.data.imageMsg}}</el-col>
                        </el-row>
                    </el-col>
                </el-row>
                <el-row class="row imgRow" v-if="dialogData.type != 'adsense'">
                    <el-col :span="4" class="label">图片</el-col>
                    <el-col :span="10">
                        <el-row gutter="10">
                            <el-col :span="10" class="uploadImg">
                                <img src="images/ewm.png">
                            </el-col>
                            <el-col :span="10">
                                <el-form-item>
                                    <el-upload
                                            action="https://jsonplaceholder.typicode.com/posts/"
                                            :on-preview="handlePreview"
                                            :on-remove="handleRemove"
                                            :file-list="fileList2"
                                            list-type="picture">
                                        <el-button size="small">上传</el-button>
                                    </el-upload>
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-row v-show="dialogData.type == 'fullAd'">
                            <el-col :span="24">
                                <el-input class="imgTitle" placeholder="点击图片后显示的标题"></el-input>
                            </el-col>
                            <el-col :span="24" v-show="dialogData.type == 'fullAd'">
                                <el-form-item>
                                    <el-input placeholder="图片链接至的URL地址"></el-input>
                                </el-form-item>
                            </el-col>
                        </el-row>
                    </el-col>
                </el-row>
                <el-row class="row imgRow" v-else>
                    <el-col :span="4" class="label">图片</el-col>
                    <el-col :span="10">
                        <el-row>
                            <el-col :span="3">
                                <el-button type="primary" icon="plus" size="small"></el-button>
                            </el-col>
                            <el-col :span="20">
                                <el-upload
                                        action="https://jsonplaceholder.typicode.com/posts/"
                                        :on-remove="handleRemove"
                                        :file-list="fileList2"
                                        >
                                    <el-button size="small">选择图片</el-button>
                                    <el-button size="small">上传</el-button>
                                </el-upload>
                            </el-col>
                            <el-col :span="24">
                                <el-input class="imgTitle" v-model="dialogData.data.title" placeholder="点击图片后显示的标题"></el-input>
                            </el-col>
                            <el-col :span="24">
                                <el-form-item>
                                    <el-input v-model="dialogData.data.title" placeholder="图片链接至的URL地址"></el-input>
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="3">
                                <el-button type="warning" icon="delete" size="small"></el-button>
                            </el-col>
                            <el-col :span="20">
                                <el-upload
                                        action="https://jsonplaceholder.typicode.com/posts/"
                                        :on-remove="handleRemove"
                                        :file-list="fileList2"
                                >
                                    <el-button size="small">选择图片</el-button>
                                    <el-button size="small">上传</el-button>
                                </el-upload>
                            </el-col>
                            <el-col :span="24">
                                <el-input class="imgTitle" v-model="dialogData.data.title" placeholder="点击图片后显示的标题"></el-input>
                            </el-col>
                            <el-col :span="24">
                                <el-form-item>
                                    <el-input v-model="dialogData.data.title" placeholder="图片链接至的URL地址"></el-input>
                                </el-form-item>
                            </el-col>
                        </el-row>
                    </el-col>
                </el-row>


                <el-row class="row" v-if="dialogData.type != 'startPage'">
                    <el-col :span="4" class="label">适用渠道</el-col>
                    <el-col :span="10">
                        <el-form-item>
                            <el-input v-model="dialogData.data.channel" placeholder="多渠道以,号间隔"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8" :offset="1">
                        <el-upload
                                class="upload-demo"
                                action="https://jsonplaceholder.typicode.com/posts/"
                                :on-preview="handlePreview"
                                :on-remove="handleRemove"
                                :file-list="fileList">
                            <el-button type="primary">上传渠道列表</el-button>
                        </el-upload>
                    </el-col>
                </el-row>
                <el-row class="row" v-if="dialogData.type != 'startPage'">
                    <el-col :span="4" class="label">有效期<span class="isMust">*</span></el-col>
                    <el-col :span="10">
                        <el-form-item>
                            <el-radio-group v-model="dialogData.data.expiryDateType">
                                <el-radio :label=0>不过期</el-radio>
                                <el-radio :label=1>自定义时间</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item v-show="dialogData.data.expiryDateType == 1 ">
                            <el-date-picker
                                    class="select"
                                    v-model="dialogData.data.expiryDate"
                                    type="datetimerange"
                                    placeholder="选择日期范围">
                            </el-date-picker>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row class="row">
                    <el-col :span="4" class="label">备注</el-col>
                    <el-col :span="10">
                        <el-form-item>
                            <el-input type="textarea" v-model="dialogData.data.note"></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click="dialogData.isShow = false">取 消</el-button>
                <el-button type="primary" @click="changeDataList">确 定</el-button>
            </div>
        </el-dialog>
    </el-row>
</template>
<script>
    import axios from "axios";
    import cgi from "conf/cgi";
    export default {
        data(){
            return {
                adtiveTab: "startPage",
                startPageData: {
                    list: null
                },
                fullAdData: {
                    searchFrom: {
                        data: {
                            device: null,
                            expiryDate: null,
                            state: null,
                            keyWords: null
                        }
                    },
                    list: null,
                    multipleSelection: []
                },
                adsenseData: {
                    searchFrom: {
                        data: {
                            device: null,
                            expiryDate: null,
                            state: null,
                            applyUser: null,
                            position: null,
                            keyWords: null
                        }
                    },
                    list: null,
                    multipleSelection: []
                },
                dialogData: {
                    isShow: false,
                    loading: false,
                    title: null,
                    type: 'startPage',
                    data: {
                        title: null,
                        state: null,
                        device: 0,
                        userType: [0],
                        position: null,
                        position2: null,
                        position3: null,
                        imageMsg: '非首次启动APP时，在启动页后显示，3秒倒计时如张数，尺寸等',
                        channel: null,
                        expiryDateType: 0,
                        expiryDate: null,
                        note: null,
                    }
                },
            }
        },
        created() {
            return axios.get(cgi.startPage)
                .then(res => {
                    if (res.code == 0) {
                        this.startPageData.list = res.data.list;
                        return res.data;
                    } else {
                        return Promise.reject("请求数据失败!");
                    }
                }, error => {
                    return Promise.reject(error.msg);
                });
        },
        methods: {
            showImage(index, rowData) {
                this.$msgbox({
                    title: '图片预览',
                    customClass: 'm-messageBoxImg',
                    message: this.$createElement('img', {style: 'color: teal', attrs: {src: rowData.imageSrc}}),
                })
            },
            adsenseHandleSelectionChange(currentRow) {
                this.adsenseData.multipleSelection = currentRow;
            },
            fullAdHandleSelectionChange(currentRow) {
                this.fullAdData.multipleSelection = currentRow;
            },
            /*
             * 新增
             * type 数据类型
             * */
            addItem(from) {
                this.handleEdit(from, 2);
            },
            /*
             * 启用数据
             * type 数据类型
             * */
            activeItem(type, rowData){
                //未传入rowData 点击批量操作
                if (typeof (rowData) == 'undefined') {
                    if ((type == 'adsense' && this.adsenseData.multipleSelection.length <= 0) || (type == 'fullAd' && this.fullAdData.multipleSelection.length <= 0)) {
                        this.$alert('请先选择要启用的记录！', '温馨提示', {
                            confirmButtonText: '确定',
                            type: 'warning'
                        });
                        return;
                    }
                    ;
                }
                this.$confirm('确定要启用吗？', '温馨提示', {})
                    .then(() => {
                        this.$message({
                            type: 'success',
                            message: '启用'
                        })
                    })
                    .catch(() => {

                    })
            },
            /*
             * 禁用数据
             * type 数据类型
             * */
            disableItem(type, rowData){

                if (typeof (rowData) == 'undefined') {
                    if ((type == 'adsense' && this.adsenseData.multipleSelection.length <= 0) || (type == 'fullAd' && this.fullAdData.multipleSelection.length <= 0)) {
                        this.$alert('请先选择要禁用的记录！', '温馨提示', {
                            confirmButtonText: '确定',
                            type: 'warning'
                        });
                        return;
                    }
                    ;
                }
                this.$confirm('确定要禁用吗？', '温馨提示', {})
                    .then(() => {
                        this.$message({
                            type: 'success',
                            message: '禁用'
                        })
                    })
                    .catch(() => {

                    })
            },
            /*
             * 删除数据
             * type 数据类型
             * */
            deleteItem(type, rowData){
                if (typeof (rowData) == 'undefined') {
                    if ((type == 'adsense' && this.adsenseData.multipleSelection.length <= 0) || (type == 'fullAd' && this.fullAdData.multipleSelection.length <= 0)) {
                        this.$alert('请先选择要删除的记录！', '温馨提示', {
                            confirmButtonText: '确定',
                            type: 'warning'
                        });
                        return;
                    }
                }
                this.$confirm('确定要删除吗？', '温馨提示', {})
                    .then(() => {
                        this.$message({
                            type: 'success',
                            message: '删除'
                        })
                    })
                    .catch(() => {

                    })
            },

            /*
             * from 操作的tab
             * type 操作类型 1修改  2增加
             * index  操作数据行
             * rowData 操作数据集合
             *
             * */
            handleEdit(from, type, index, rowData) {
                //handleEdit('startPage',1,scope.$index, scope.row)
                this.dialogData.type = from;
                if (type == 1) {
                    this.dialogData.loading = true;
                    this.dialogData.title = '修改';

                } else if (type == 2) {
                    this.dialogData.loading = false;
                    this.dialogData.title = '新增';
                    for (let item in this.dialogData.data) {
                        this.dialogData.data[item] = null;
                    }
                }
                switch (from) {
                    case 'startPage':
                        this.dialogData.isShow = true;
                        break;
                    case 'fullAd':
                        this.dialogData.isShow = true;
                        break;
                    case 'adsense':
                        this.dialogData.isShow = true;
                        break;
                    default:
                        console.log('未匹配到类型');
                }
            },
            /*
             * type 搜索类型
             * */
            searchTableData(type) {
                this.getTableData(type);
            },
            getTableData(type) {
                var queryData = {
                    uri: null,
                    data: null
                };
                if (type == 'fullAd') {
                    queryData.uri = cgi.fullAd;
                } else if (type == 'adsense') {
                    queryData.uri = cgi.adsense;
                }
                return axios.get(queryData.uri)
                    .then(res => {
                        if (res.code == 0) {
                            if (type == 'fullAd') {
                                this.fullAdData.list = res.data.list;
                                console.log(res.data)
                            } else if (type == 'adsense') {
                                this.adsenseData.list = res.data.list;
                            }
                            return res.data;
                        } else {
                            return Promise.reject("请求数据失败!");
                        }
                    }, error => {
                        return Promise.reject(error.msg);
                    });
            },
        }
    }
</script>
<style lang="scss" type="text/scss" scoped>
    @import "../../../../sprites/_variable";

    .m-adManage {
        background-color: #fff;
        .layout-1 {
            padding: 15px;
            border-bottom: solid 15px $background-colorA;
        }
        .layout-2 {
            padding: 15px;
            .right {
                text-align: right;
                .time {
                    margin-right: 20px;
                    font-size: 15px;
                }
            }
        }
        .layout-3 {
            padding: 15px;
            .operated {
                text-align: center;
            }
            .minImg {
                width: auto;
                height: 50px;
                cursor: pointer;
            }
            .stateA {
                color: $color-success;
            }
            .stateB {
                color: $color-danger;
            }
        }
        .layout-4 {
            padding-left: 15px;
            margin-bottom: 15px;
        }
    }

    .m-adManageDialog {
        .imgRow {
            margin: 15px 0;
            .imgTitle {
                margin: 3px 0;
            }
            .uploadImg {
                img {
                    width: 100%;
                    height: 100%;
                }
            }
        }
        .row {
            .iseffective {
                display: inline-block;
            }
            .flag {
                display: inline-block;
            }
            .tipmsg {
                background-color: $background-colorA;
                padding: 5px 5px 20px 5px;
            }
        }
        .select {
            width: 100%;
        }
        .label {
            text-align: right;
            padding-right: 10px;
            line-height: 36px;
            .isMust {
                padding-left: 3px;
                color: $color-danger;
            }
        }
    }
</style>